package operativa.model.dao;

import java.util.List;
import operativa.bean.entity.Location;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;

public class LocationDAO extends GenericHibernateDAO<Location, Integer> {

	@Override
	public void makeTransient(Integer id) {
		@SuppressWarnings("unused")
		Transaction tx =  super.getSession().beginTransaction();
		Location oldLocation = (Location) super.getSession().get(Location.class, id);
		super.getSession().delete(oldLocation);		
	}
	
	public List<Location> getByTipoUbicacion(String tipoUbicacion){
		return this.findByCriteria(Restrictions.eq("type", tipoUbicacion));
	}
	
}
